package org.example.cdpcrpbackend.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import lombok.RequiredArgsConstructor;
import org.example.cdpcrpbackend.controller.dto.StudentInfo;
import org.example.cdpcrpbackend.domain.Student;
import org.example.cdpcrpbackend.mapper.StudentMapper;
import org.example.cdpcrpbackend.service.StudentService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> implements StudentService {
    private final StudentMapper studentMapper;
    @Override
    public Student login(String username, String password) {
        return studentMapper.login(username, password);
    }

    @Override
    public StudentInfo studentInfo(String studentId) {
        return studentMapper.studentInfo(studentId);
    }

    @Override
    public List<StudentInfo> listByPage(String key, String cid, Integer page, Integer size) {
        PageHelper.startPage(page, size);
        return studentMapper.listByCondition(cid, key);
    }
}
